<!doctype html>
<html>
<head>
    <meta charset="utf8">
    <title><?=$data['title'];?></title>
    <meta name="keywords" content="个人博客,一起学习,一起成长" />
    <meta name="description" content="在成长的路上不断的学习，进步" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/base.css" rel="stylesheet">
    <link href="css/index.css" rel="stylesheet">
    <link href="css/m.css" rel="stylesheet">
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery.easyfader.min.js"></script>
    <script src="js/scrollReveal.js"></script>
    <script src="js/common.js"></script>
    <!--[if lt IE 9]>
    <script src="js/modernizr.js"></script>
    <style>
        p.fbinfo {
            margin: 10px 0;
        }


    </style>
    <![endif]-->
</head>
<body>
<header>
    <!--menu begin-->

    <?php include 'menu.php';?>
    <?php include 'mnav.php';?>
    <!--menu end-->
    <!--mnav begin-->


    <!--mnav end-->
</header>
<article>

     <div class="infosbox">
        <div class="newsview">
            <h3 class="news_title"><?=$data['title']?></h3>
            <div class="bloginfo">
                <ul>
                    <li class="timer"><?=date('Y-m-d',$data['create_time']);?></li>
                    <li class="view">Alps</li>
                </ul>
            </div>
            <div class="tags">
                <?php foreach ($data['tags'] as $lino => $line): ?>
                    <a target="_blank"><?=$line ?></a>
                <?php endforeach; ?>
            </div>

            <div class="news_con">
                <?=$data['content']?>
            </div>
        </div>
         <div class="share">
             <div>
                 <button class="diggit" onclick="checkClick()" > 很赞哦 (<b id="diggnum"><?= $com['number']?></b>)</button>
             </div>

         </div>
         <div class="news_pl">
             <h2>文章评论</h2>
             <ul>
                 <div class="gbko">

                     <div class="fb" style="margin: 20px">
                         <?php foreach($list as $k =>$v): ?>

                         <ul>
                             <div style="display: inline">
                                 <span> <img src="<?= $v['img']?>" alt="" style="width: 50px;height: 50px; float: left;padding: 5px;background-color: #FFEFDB"><?= $v['name']?></span>
                                 <span style="float: right"><?= date('Y-m-d',$v['create_time'])?></span>
                                 <p class="fbinfo" style="margin: 10px 0;"><?= $v['content']?></p>
                             </div>
                         </ul>
                         <HR>
                         <?php endforeach; ?>

                     </div>
                     <form  >
                         <div id="plpost" >
                             <input type="hidden" name="username" value="<?= $username ?>">
                             <input type="hidden" name="sid" value="<?=$sid?>">
                             <input type="hidden" name="_csrf" value="<?=\Yii::$app->request->csrfToken?>">
                             <textarea name="content" rows="6" id="saytext" style="width: 100%"></textarea>

                         </div>
                         <button type="button" onclick="check()">提交

                     </form>

                 </div>
             </ul>
         </div>

         </div>

    </div>

</article>
<footer>
    <p>Design by <a href="" target="_blank">个人博客</a> <a href="/">粤ICP备19035164号</a></p>
</footer>
<a href="#" class="cd-top">Top</a>
<script>
    function checkClick() {
        var id = "<?= $sid?>";
        var username = "<?= $username?>";
        $.ajax({

            url: "index.php?r=post/zan",
            data: {sid:id ,username:username,id:<?=$id?>},
            type: "get",
            dataType : 'json',
            success: function (msg) {
                if (msg.status ==200){
                    document.getElementById("diggnum").innerHTML=msg.data
                    alert(msg.msg)
                }else {
                    alert(msg.msg)
                }

            }


            });
    }
    function check() {
        var  id= "<?= $id?>";
        var sid = "<?= $sid?>";
        var username = "<?= $username?>";
        var text =  document.getElementById("saytext").value;
        if(text.length == 0){
            alert("内容不允许为空")
            return false;
        }
        $.ajax({

            url: "index.php?r=post/speak",
            data: {sid:sid ,username:username,id:id,content:text},
            type: "get",
            dataType : 'json',
            success: function (msg) {
                if (msg.status ==200){
                    document.getElementById("saytext").value= '';
                    alert(msg.msg)
                }else {
                    alert(msg.msg)
                }

            }


        });
    }



</script>
</body>

</html>


